package thomas.javase.collection;

import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

public class ListTest {

    @Test
    public void testSubList(){
        List<String> numbers = Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9");
        System.out.println(Lists.partition(numbers, 2));
        System.out.println(Lists.partition(numbers, 3));
        System.out.println(Lists.partition(numbers, 5));
    }

/*    // Generic function to split a list into two sublists in Java using Guava
    public static<T> List[] split(List<T> list, int subListSize)
    {
        // partition the List into two sublists
        List<List<T>> lists = Lists.partition(list, subListSize);
        return lists;
    }*/
}
